{extend name="base" /}
{block name="css"}
{css href="__CSS__/pay.css" /}
{/block}
{block name="body"}
<!-- 主要内容 开始 -->
<div class="weui-tab__bd-item">
  <header class="weui-navBar weui-navBar-fixed">
    <a href="javascript:history.go(-1);" class="weui-navBar-item">
      <i class="icon iconfont icon-fanhui"></i>
    </a>
    <div class="weui-center">
      <span class="weui-center-title">转出</span>
    </div>
    <a href="deposit_log.html" class="weui-navBar-item">
      账单
    </a>
  </header>
  <div class="weui-cells weui-cells_form">
    <div class="weui-cell">
      <div class="weui-cell__hd"><label for="date" class="weui-label">转出方式</label></div>
      <div class="weui-cell__bd">
        <input class="weui-input" id="payment" type="text" value="零钱" readonly data-values="001">
      </div>
    </div>
    <div class="divHeight"></div>
    <div class="weui-pay-inner">
      <h1 class="weui-pay-title">转出金额(元)</h1>
      <div class="weui-pay-input"> <strong class="weui-pay-strong">￥</strong>
        <input type="number" name="money" class="weui-pay-inputs" placeholder="请输入金额">
      </div>
      <div class="weui-pay-intro">零钱余额￥<b>{$info|default="0.00"}</b>,<span class="f-blue">全部转出</span></div>
    </div>
    <p class="weui-pay-info">支付金额给商户</p>
      <div class="weui-btn-area">
          <a href="javascript:;" class="weui-btn weui-btn_primary" style="display: none;">立即支付</a>
      </div>
  </div>
</div>
<!-- 主要内容 结束 -->
{/block}
{block name="js"}
<script type="text/javascript">
  $(function () {
    $('#inline').click(function() {
      $.toptip('选择转出方式');
    });
    $('.f-blue').click(function() {
      //读取余额赋值给money
      var money = $(this).prev().text();
      $(".weui-pay-inputs").val(money);
      if ($(".weui-pay-inputs").val()>0) $('.weui-btn').show();
    });
    $("#payment").select({
      title: "选择转出方式",
      items: [
        {
          title: "零钱",
          value: "001",
        },
        {
          title: "招商银行",
          value: "002",
        },
        {
          title: "建设银行",
          value: "003",
        }
      ]
    });
    /*失去焦点触发*/
    $(".weui-pay-inputs").blur(function(){
      if ($(this).val()>0 && $(this).val()<= $('b').text()) $('.weui-btn').show();
    })
    $('.weui-pay-btn').click(function() {
      var num = $('.weui-pay-inputs').val();
      if(!is_weixin()) $.toptip('请在微信中进行充值！','error');
      else if(!num || !/^(([1-9]\d*)|\d)(\.\d{1,2})?$/.test(num)) $.toptip('请输入充值金额！');
      else if (num>500) $.toast('充值金额大于500了哟！','text');
      else $.alert('充值金额'+num+'元');
    });
  });
</script>
{/block}